default: depend all

all: lib

CC:=g++ 
CFLAGS:= $(CPPFLAGS)
AR:=ar
ARFLAGS:= cru
LIBNAME:= libnetwork.a
RANLIB:=ranlib
INCS:= -I.
LIBDIRS:= -L.
LIBS:= -lbyz
LIBBYZ:= libbyz.a

CPPFLAGS:= $(INCS) -g -Wall -O3 #-pg
#CPPFLAGS:= $(INCS) -g -Wall -pedantic

C_FILES= $(wildcard *.cc)

H_FILES := TCPNetwork.hpp NetDevice.hh BaseNode.hpp

%.o:: %.cc
	$(CC) $(CPPFLAGS) -o $@ -c $<

OBJ_FILES:=$(C_FILES:%.cc=%.o) 
#$(c_FILES:%.c=%.o)

depend: .depend
	@echo --- Generating dependencies
	$(CC) $(CFLAGS) -MM $(C_FILES) > .depend

.depend:
	touch .depend

include .depend

objs: $(OBJ_FILES)

lib: $(LIBNAME)

$(LIBNAME): objs
	$(AR) $(ARFLAGS) $(LIBNAME) $(OBJ_FILES)

clean:
	-rm -f *.o
	-rm -f *~ 
	-rm -f *.a
